
layui.config({
  base: '/' //假设这是你存放拓展模块的根目录
}).extend({ //设定模块别名
  murl: 'url'
});

var apply = {
    baseUrl: "/api_account_log",
    entity: "user",
    tableId: "userTable",
    toolbarId: "toolbar",
    unique: "id",
    order: "desc",
    currentItem: {}
};
apply.columns = function () {
    return [{
        field: 'name',
        title: '销售员'
    }, {
        field: 'operate',
        title: '类型'
    }, {
        field: 'money',
        title: '金额'
    }, {
        field: 'notes',
        title: '销售内容'
    }, {
      field: 'crtTime',
      title: '时间'
   }];
};
apply.queryParams = function (params) {
    if (!params)
        return {
            type:"invite",
            beginTime: $("#beginTime").val(),
            endTime:$("#endTime").val()
        };
    var temp = { //这里的键的名字和控制器的变量名必须一直，这边改动，
        type:"invite",
        limit: params.limit, //页面大小
        offset: (params.offset / params.limit)+1, //页码
        beginTime: $("#beginTime").val(),
        endTime:$("#endTime").val()
    };
    return temp;
};




layui.use(['form', 'layedit', 'laydate'], function () {
    //apply.init();

    var editIndex;
    var layerTips = parent.layer === undefined ? layui.layer : parent.layer, //获取父窗口的layer对象
        layer = layui.layer, //获取当前窗口的layer对象
        layedit = layui.layedit,
        laydate = layui.laydate;

     laydate.render({
           elem: '#beginTime' //指定元素
         });
     laydate.render({
        elem: '#endTime' //指定元素
     });
    var addBoxIndex = -1;
    //初始化页面上面的按钮事件
    $('#btn_query').on('click', function () {
        apply.table.bootstrapTable('refresh', apply.queryParams());
    });

    var ctx = document.getElementById("myChart");

        var myChart = new Chart(ctx, {

        type: 'line',

        data: {

            labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],

            datasets: [{

                label: '销售月报',

                data: [12, 19, 3, 5, 2, 3]

            }]

        },

        options: {

            scales: {

                yAxes: [{

                    ticks: {

                        beginAtZero:true

                    }

                }]

            }

        }

    });


});